package promote.brozen.base.juc;

import promote.brozen.utils.concurrent.Threads;

import java.util.concurrent.locks.LockSupport;

/**
 * @author Brozen
 * @date 2020/8/13 5:55 PM
 * @email brozen@qq.com
 */
public class ParkAndInterrupt {

    public static void main(String[] args) {
        Object blocker = new Object();
        Thread mainThread = Thread.currentThread();

        new Thread(() -> {
            Threads.silentSleep(1000L);
            System.out.println("中断唤醒");
            mainThread.interrupt();
        }).start();

        System.out.println(mainThread.isInterrupted());
        LockSupport.park(blocker);
        System.out.println("main 被唤醒");
        System.out.println(mainThread.isInterrupted());
    }

}
